package code.tools.commponents
{
	import code.main.AppCommonData;
	import code.structure.module.config.data.ShopItemData;
	
	import com.patience.mvc.context.ContextIntance;
	
	/**
	 *
	 *@author wenqiang.deng
	 *Create time:2013-5-21 下午1:27:01
	 */
	public class ItemIcon extends SimpleIcon
	{
		private var _shopItemData:ShopItemData;
		
		
		public function ItemIcon():void
		{
			super();
		}
		
		/**
		 *清理icon 
		 * 
		 */		
		override public function clear():void
		{
			_shopItemData = null
			super.clear();
		}
		
		/**
		 *设置物品ID，通过ID获取物品信息，物品的icon地址 
		 * @param item_id
		 * @param isMc 是否是动画
		 * 
		 */		
		public function setItemId(item_id:int,isMc:Boolean = false):void
		{
			if(_shopItemData!=null && _shopItemData.id == item_id)return;
			clear();
			_shopItemData = (ContextIntance.getContext().commonData as AppCommonData).configModel.getItemByID(item_id);
			if(_shopItemData!=null)
			{
				setIconInfo(_shopItemData.sPath,'ICON',_shopItemData.fileType,isMc);
			}
		}
		
		
		public function get shopItemData():ShopItemData
		{
			return _shopItemData;
		}
		
	}
}